package com.balarawool.continuations.platformthread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import static com.balarawool.continuations.ExecutorUtils.shutdownExecutor;

public class Scheduler {

    private final ExecutorService executor = Executors.newFixedThreadPool(10);

    public void schedule(Runnable runnable) {
        executor.submit(runnable);
    }

    public void stop() {
        shutdownExecutor(executor, 10, TimeUnit.SECONDS);
    }
}
